	$(document).ready(function(){
		InitBuyPremium();
	});
	
	/*
	var id_prem=$(this).find("option:selected").attr('id');			
						
		$.ajax({ type: 'POST',async:false,  url: $("#url_getprice").val(),data: {id:id_prem},success:function(data)
		{
			$('#vip_price').text(data);
			
			var txt=$('#vipPayBtn').attr('href');
			xt=txt.slice(0, -1)
			txt+=id_prem;
			$('#vipPayBtn').attr('href',txt);
				
		}});
	}*/
	
	
	function changePrice(id_prem,price_place,acunt_url)
	{
					
						
		$.ajax({ type: 'POST',async:false,  url: $("#url_getprice").val(),data: {id:id_prem},success:function(data)
		{
			$(price_place).text(data);
			
			var txt=$(acunt_url).attr('href');
			txt=txt.slice(0, -1)
			txt+=id_prem;
			$(acunt_url).attr('href',txt);
				
		}});
	}
	
	function InitBuyPremium()
	{	
		changePrice(4,'#vip_price','#vipPayBtn');
		changePrice(1,'#premium_price','#premiumPayBtn');
		
		$("#vip_selector").change(function()
		{			
			var id_prem=$(this).find("option:selected").attr('id');	
			changePrice(id_prem,'#vip_price','#vipPayBtn');
		});
		
		$("#premium_selector").change(function()
		{			
			var id_prem=$(this).find("option:selected").attr('id');	
			changePrice(id_prem,'#premium_price','#premiumPayBtn');
		});
		
	}